Skip to content

Add readiness probe for NGINX on pod startup #3629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 18, 2025

Conversation

salonichf5
Copy link
Contributor

@salonichf5 salonichf5 commented Jul 15, 2025

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: Users want to have a readiness probe for NGINX on startup to verify pod health.

Solution: Expose readiness probe configuration fields in the NginxProxy spec, allowing users to customize them as needed. By default, deploy NGINX with a readiness probe at the /readyz endpoint.

Testing: Manual testing

  1. Readiness Probe empty - Nginx starts successfully, Nginx Proxy config has default values for readiness probe, Nginx deployment reflects the same, Health check server listening at 8081.

values.yaml

  readinessProbe: {}

Nginx proxy Config

Spec:
  Ip Family:  dual
  Kubernetes:
    Deployment:
      Container:
        Image:
          Pull Policy:  Never
          Repository:   nginx-gateway-fabric/nginx
          Tag:          sa.choudhary
      Replicas:         1
    Service:
      External Traffic Policy:  Local
      Type:                     LoadBalancer
Events:                         <none>


Nginx Deployment

http-get http://:8081/readyz delay=3s timeout=1s period=10s #success=1 #failure=3
  1. Fields are set for the readiness Probe config
    Nginx starts successfully, Nginx Proxy config has correct values for readiness probe fields, Nginx deployment reflects the same
readinessProbe:
    port: 8083
    initialDelaySeconds: 5

NGINX deployment

    SeccompProfile:  RuntimeDefault
    Readiness:       http-get http://:8083/readyz delay=5s timeout=1s period=10s #success=1 #failure=3


Nginx proxy config

Spec:
    Deployment:
      Container:
        Image:
          Pull Policy:  Never
          Repository:   nginx-gateway-fabric/nginx
          Tag:          sa.choudhary
        Readiness Probe:
          Initial Delay Seconds:  5
          Port:                   8083
      Replicas:                   1


Server block

# Health check server block listening at 8083
server {
    listen 8083;

    location = /readyz { 
        access_log off;
        return 200;
    }
}



  1. Now update the fields using Nginx proxy config

Nginx restarts a new pod successfully, Nginx deployment reflects the same, server block port is updated

## updating nginx proxy config

    Deployment:
      Container:
        Image:
          Pull Policy:  Never
          Repository:   nginx-gateway-fabric/nginx
          Tag:          sa.choudhary
        Readiness Probe:
          Initial Delay Seconds:  15
          Port:                   8085


NGINX deployment

    SeccompProfile:  RuntimeDefault
    Readiness:       http-get http://:8085/readyz delay=15s timeout=1s period=10s #success=1 #failure=3

Server block


# Health check server block
server {
    listen 8085;

    location = /readyz { 
        access_log off;
        return 200;
    }
}

  1. verified the above sets for deployment type DaemonSet as well.

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #3594

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

Readiness probe settings for NGINX are now configurable in the `NginxProxy` spec. 

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request helm-chart Relates to helm chart labels Jul 15, 2025
@salonichf5 salonichf5 force-pushed the feat/nginx-readinessProbe branch from 7cb82dc to 1b718a5 Compare July 15, 2025 22:16
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.10%. Comparing base (da6ad1e) to head (87a298a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3629      +/-   ##
==========================================
+ Coverage   87.02%   87.10%   +0.08%     
==========================================
  Files         127      127              
  Lines       15471    15517      +46     
  Branches       62       62              
==========================================
+ Hits        13463    13516      +53     
+ Misses       1853     1848       -5     
+ Partials      155      153       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@salonichf5 salonichf5 marked this pull request as ready for review July 16, 2025 14:05
@salonichf5 salonichf5 requested a review from a team as a code owner July 16, 2025 14:05
@salonichf5 salonichf5 force-pushed the feat/nginx-readinessProbe branch from fad90d4 to a48dbf0 Compare July 17, 2025 15:47
@salonichf5 salonichf5 requested review from sjberman and bjee19 July 17, 2025 15:49
@salonichf5 salonichf5 requested a review from sjberman July 17, 2025 18:02
@salonichf5 salonichf5 force-pushed the feat/nginx-readinessProbe branch from 572c5b4 to 5dd1fd8 Compare July 17, 2025 18:10
@salonichf5 salonichf5 force-pushed the feat/nginx-readinessProbe branch from 5dd1fd8 to 19bb3ec Compare July 18, 2025 17:19
Copy link
Collaborator

@sjberman sjberman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! just a couple small things

Copy link
Contributor

@bjee19 bjee19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job, lgtm after single comment and Saylor's comments

@salonichf5 salonichf5 requested a review from sjberman July 18, 2025 19:07
@salonichf5 salonichf5 enabled auto-merge (squash) July 18, 2025 19:11
@salonichf5 salonichf5 merged commit 0ca388f into main Jul 18, 2025
104 of 106 checks passed
@salonichf5 salonichf5 deleted the feat/nginx-readinessProbe branch July 18, 2025 19:57
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NGINX Gateway Fabric Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request helm-chart Relates to helm chart release-notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

v 2.x No Readiness or Liveness Probes for the Data Plane
3 participants